/**
 * Copyright (c) 2009 Cerner Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Cerner Corporation - initial API and implementation
 */
package com.cerner.system.rest.jaas.cas;

/**
 * Fault that indicates that the user could not be logged it because of missing
 * credential or CAS-specific URL information.
 * 
 * @author Alex Horn
 * @since 1.0.0
 */
public class CasLoginPrepareException extends CasLoginException {

  private final boolean isCasLoginUrlNull;
  private final boolean isUsernameNull;
  private final boolean isPasswordNull;

  CasLoginPrepareException(boolean isCasLoginUrlNull, boolean isUsernameNull,
      boolean isPasswordNull) {
    super(
        "Unable to login because of missing  missing credential or CAS information.");

    this.isCasLoginUrlNull = isCasLoginUrlNull;
    this.isUsernameNull = isUsernameNull;
    this.isPasswordNull = isPasswordNull;
  }

  /**
   * Determine if the login failed due to missing {@code casLoginUrl}
   * information.
   */
  boolean isCasLoginUrlNull() {
    return this.isCasLoginUrlNull;
  }

  /**
   * Determine if the login failed due to missing username information.
   */
  boolean isUsernameNull() {
    return this.isUsernameNull;
  }

  /**
   * Determine if the login failed due to missing password information.
   */
  boolean isPasswordNull() {
    return this.isPasswordNull;
  }

  private static final long serialVersionUID = 0;

}
